package Blog.Managerv6;

import java.awt.event.ActionEvent;
import java.util.List;

public class LoginListener implements java.awt.event.ActionListener{
	
	private javax.swing.JTextField t;
	private javax.swing.JFrame jf;
	private CreateBlogs cb;
	public LoginListener(CreateBlogs cb){
		
		this.cb=cb;
	}
	public void actionPerformed(ActionEvent e) {
		CreateBlogs cb=new CreateBlogs();
		List<User> userList=cb.getUsers();
		for(int i=0;i<userList.size();i++){
			if(t.getText().equals(userList.get(i).getAccount())){
				Manager m=new Manager(cb);
				m.showUI();
				jf.dispose();
			}else {
				t.setText("");
			}
		}
		
	}

}
